<template>
  <div style="width:100%">
    <a-page-header :ghost="false" title="通知/NOTICE" />
    <a-card style="margin-left: 16px;margin-right: 16px;margin-top: 16px;">
      <a-list item-layout="horizontal" :data-source="data">
        <a-list-item slot="renderItem" slot-scope="item">
          <a-list-item-meta :description="item.noticeText">
            <a slot="title">{{ item.username }}</a>
            <a-avatar :size="48" slot="avatar" :src="item.avatar" />
          </a-list-item-meta>
        </a-list-item>
      </a-list>
    </a-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      data: []
    };
  },
  created() {
    this.getNotice();
  },
  methods: {
    getNotice() {
      this.$axios
        .get("/get/notices", {
          headers: {
            Authorization: localStorage.getItem("token")
          }
        })
        .then(res => {
          if (res.data.code == 200) {
            this.data = res.data.data;
          } else {
            this.$message.error(res.data.msg);
          }
        });
    }
  }
};
</script>
<style scoped>
.ant-layout-content {
  margin: 0;
}
</style>
